package org.springframework.validation.util;

import javax.servlet.http.HttpServletRequest;

public class MvcVariableResolver extends ModelAndMapsVariableResolver {
	
	public static final String REQUEST_PARAMETERS = "requestParameters";
	public static final String REQUEST_ATTRIBUTES = "requestAttributes";
	public static final String SESSION = "session";
	
	@SuppressWarnings("unchecked")
	public MvcVariableResolver(HttpServletRequest request, Object model) {
		super(model); // hurr.
		addMapContext(REQUEST_PARAMETERS, RequestUtils.buildParameterMap(request));
		addMapContext(REQUEST_ATTRIBUTES, RequestUtils.buildAttributeMap(request));
		addMapContext(SESSION, RequestUtils.buildSessionMap(request));		
	}

}
